New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

releaselog

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

releaselog

Gets the contents of a specific release from a changelog

  • 2.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
95
increased by31.94%
Maintainers
1
Weekly downloads
 
Created
Source

Releaselog

Releaselog extracts the title and notes for a specific release from a CHANGELOG. For details on why to keep a CHANGELOG, CHANGELOG best practices, etc see https://keepachangelog.com/.

Installation

npm install releaselog

Command Line Usage

The releaselog command line interface is run as follows:

Usage: releaselog [options] <version>

Options:
  -c, --changelog <file>  the path to the CHANGELOG (directory or file) (default: "./")
  -f, --format <value>    the output format ("json", "title", or "notes") (default: "json")
  -h, --help              output usage information

The version to extract from the CHANGELOG must be provided. For example, to output the details for version 1.0.0 from a CHANGELOG in the current directory to a JSON file (assuming installed globally):

> releaselog 1.0.0 > release.json

# release.json:
# {"title":"Version 1.0.0","notes":"Initial release"}

The format option can be used to extract a subset of the release details (title or notes). From the example above, to output only the release notes for version 1.0.0 to a file:

> releaselog --format=notes 1.0.0 > release_notes.txt

# release_notes.txt:
# Initial release

The optional changelog parameter can be used to provide the path to either a file or directory. If not provided, the current working directory is used. If any directory is specified, the findChangelog function is used to find the CHANGELOG file. See below for details on how the CHANGELOG file is selected.

Module Usage

The releaselog module includes two functions: getReleaseDetails and findChangelog.

getReleaseDetails returns an object with the title and notes for the given version if found in the specified CHANGELOG.

const releaselog = require('releaselog');
const { title, notes } = releaselog.getReleaseDetails('./CHANGELOG.md', '1.0.0');

See below for CHANGELOG requirements for use with releaselog.

If not know, findChangelog can be used to return the full path of the CHANGELOG in the specified directory.

const releaselog = require('releaselog');
const changelog = releaselog.findChangelog('./');
const { title, notes } = releaselog.getReleaseDetails(changelog, '1.0.0');

This finds the "primary" CHANGELOG in the specified location. The CHANGELOG name must contain "changelog" (case-insensitive). e.g. CHANGELOG, changelog.md, CHANGELOG-EE.md. If multiple CHANGELOGs are found in that directory, changelog.md (case-insensitive) is assumed to be primary. Otherwise, the first CHANGELOG in the directory listing is used.

Changelog Requirements

Releaselog is designed to support whatever versioning scheme is used - SemVer, CalVer, etc. It also allows flexibility in the CHANGELOG format, but it must conform to the following requirements:

  • The file format must be markdown
  • Version titles must use markdown headers. The header can be any level ## - ##### (not #), but the same header type must be used for all titles.
  • The text of the version must be included in the version title line. If the version starts with "v" (e.g. "v1.1.0"), it will be stripped and the remaining text is used (e.g. "1.1.0").

Once the current version is found, the header format for that line is assumed for all versions, and the next occurrence in the CHANGELOG will signal the end of the release content. All text between those lines will be included in the release notes, allowing flexibility in the release note content.

As an example, searching the following CHANGELOG for version "v1.1.0" (note the "v" is stripped before searching the CHANGELOG):

# Changelog

## Version 1.1.0 (2019-02-03)

### Added

- Add new feature 1
- Add another new feature

### Fixed

- Update `foo` to fix `bar`

## Version 1.0.0 (2019-01-26)

- Initial release

Results in a release with the title Version 1.1.0 (2019-02-03) and the following notes:

### Added

- Add new feature 1
- Add another new feature

### Fixed

- Update `foo` to fix `bar`

Keywords

FAQs

Package last updated on 26 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc